import multiprocessing
from tendo.singleton import SingleInstance
from road_gps import gpsSever
from gps_transfer import gpsTransferSever
from utils.gps_device import recv_cyc

try:
    Single = SingleInstance()
except:
    print('main process already  exist! ')
    exit()

if __name__ == '__main__':
    print("start Running RTK...")
    dict = multiprocessing.Manager().dict()
    recv_cyc = multiprocessing.Process(target=recv_cyc, args=(dict,))
    recv_cyc.start()
    gpsProc = multiprocessing.Process(target=gpsSever, args=(dict,))
    gpsProc.start()
    gpsTransferProc = multiprocessing.Process(target=gpsTransferSever)
    gpsTransferProc.start()

    recv_cyc.join()
    gpsProc.join()
    gpsTransferProc.join()

